Including pybind11 causes Emscripten to fail build 您所在的位置:网站首页 pybind11 qt Including pybind11 causes Emscripten to fail build

Including pybind11 causes Emscripten to fail build

#Including pybind11 causes Emscripten to fail build | 来源: 网络整理| 查看: 265

I have a basic QML/C++ Qt app I am able to compile to WebAssembly using Emscripen. I am trying to use pybind11 on the C++ side so I can embed Python. It works as expected when I build and execute on my system.

#if defined(_DEBUG) #undef _DEBUG #include #define _DEBUG #else #include #endif #include #include #include #include #include using namespace std; void say_something () { printf ("Say Something nicely\n"); } static int COUNTER = 0; void set_counter (int count) { COUNTER = count; } struct MyData { float x; }; struct MyDataPython { float x; float y; MyDataPython () : x(0), y(0) {} MyDataPython (float x, float y) : x(x), y(y) {} }; PYBIND11_EMBEDDED_MODULE (embeddedmodule, module) { module.doc () = "Embedded Module"; module.def ("say_something", &say_something); module.def ("set_counter", &set_counter); pybind11::class_(module, "MyData") .def_readwrite ("x", &MyData::x); } int main(int argc, char *argv[]) { // TESTING pybind11 stuff here ///////////////////////////////////////////////////////////////////// pybind11::scoped_interpreter guard{}; //Python executed pybind11::exec ("print('hello world')"); pybind11::exec ("from test_mod import Test"); pybind11::exec ("test = Test()"); pybind11::exec ("import embeddedmodule\nembeddedmodule.say_something()"); cout


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有